package VektoriTesti;

import java.awt.Color;
import java.awt.Graphics;
import java.awt.Toolkit;
import java.util.ArrayList;
import javax.swing.JComponent;

/**
 *
 * @author Smai
 */
public class Canvas extends JComponent {

  Toolkit toolkit = Toolkit.getDefaultToolkit();
  public ArrayList<Pallo> pallot = new ArrayList<Pallo>();
  public int mouseX;
  public int mouseY;

  @Override
  public void paint(Graphics g) {
    g.setColor(Color.white);
    g.fillRect(0, 0, 600, 600);


    g.setColor(Color.black);
    g.drawString("Hiiri: " + mouseX + "," + mouseY, 32, 32);



    for (int i = 0; i < pallot.size(); i++) {
      pallot.get(i).paint(g);
    }

    g.setColor(Color.black);
    g.drawLine(300, 300, mouseX, mouseY);
  }
}
